package com.innovation.chengzhangriji.ui;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.innovation.chengzhangriji.Baby;
import com.innovation.chengzhangriji.BabyAndParent;
import com.innovation.chengzhangriji.Config;
import com.innovation.chengzhangriji.Parent;
import com.innovation.chengzhangriji.R;
import com.innovation.chengzhangriji.database.DatabaseManager;
import com.innovation.chengzhangriji.http.BabyAddRequestBody;
import com.innovation.chengzhangriji.http.BabyAllResponse;
import com.innovation.chengzhangriji.http.Change;
import com.innovation.chengzhangriji.http.Client;
import com.innovation.chengzhangriji.http.ResponseHandler;
import com.innovation.chengzhangriji.preferences.LoginInfo;
import com.innovation.chengzhangriji.ui.widget.CuteButton;
import com.innovation.chengzhangriji.ui.widget.CuteTextView;
import com.innovation.chengzhangriji.ui.widget.CuteToolbar;
import com.innovation.chengzhangriji.util.ChZhRJUtils;
import com.makeramen.roundedimageview.RoundedImageView;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

public class BabyNoticeDetailActivity extends BaseActivity implements CuteToolbar.OnClickCuteToolbarListener {
    private boolean delete,isnotice;
    private CuteTextView tv_name,tv_phone,tv_join_time,tv_shenfen,tv_quanxian,tv_neirong,tv_nikename;
    private RoundedImageView imageView_head;
    private CuteToolbar toolbar;
    private String info,range,permission,mOldRole;
    private DisplayImageOptions options;
    private CuteButton btnCancel;
    private int role=-1,myrole=-1,myper=-1,myneirong=-1;
    private ImageView iv_shenfen_next,iv_quanxian_next,iv_neirong_next;
    private RelativeLayout relativeLayout_shenfen,relativeLayout_quanxian,relativeLayout_neirong;
    private BabyAllResponse babyAllResponse;
    private boolean b_quanxian = true,b_shenfen= true,b_neirong=true;
    private LinearLayout phonenumber,notice_detail_relation;

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == 1001 && resultCode == RESULT_OK) {
            updateDb();
        } else if (requestCode == 1002 && resultCode == RESULT_OK) {
            delete();
        }else if (requestCode == 023 && resultCode == RESULT_OK){
            tv_name.setText(data.getStringExtra("relationship"));
        }else if (requestCode == 1 && resultCode == RESULT_OK) {
            String shenfen = data.getStringExtra("shenfen");
            tv_shenfen.setText(shenfen);
            switch (shenfen){
                case "家长":
                    myrole = 1;
                    myper = 1;
                    tv_quanxian.setText("一起记");
                    iv_quanxian_next.setVisibility(View.GONE);
                    b_quanxian = false;
                    b_shenfen = true;
                    b_neirong = true;
//                    tip(4);
                    break;
                case "成员":
                    myrole = 0;
//                    myper = 1;
//                    tv_quanxian.setText("一起记");
                    iv_quanxian_next.setVisibility(View.VISIBLE);
                    b_quanxian = true;
                    b_shenfen = true;
                    b_neirong = true;
//                    tip(5);
                    break;
                default:
                    myrole = -1;
                    break;
            }
        }else if (requestCode == 2 && resultCode == RESULT_OK) {
            String quanxian = data.getStringExtra("quanxian");
            tv_quanxian.setText(quanxian);
            switch (quanxian){
                case "一起记":
                    myper = 1;
                    break;
                case "围观":
                    myper = 0;
                    break;
                default:
                    myper = -1;
                    break;
            }
        }else if (requestCode == 3 && resultCode == RESULT_OK) {
            String neirong = data.getStringExtra("neirong");
            tv_neirong.setText(neirong);
            switch (neirong){
                case "从加入后":
                    myneirong = 0;
                    break;
                case "从备孕期":
                    myneirong = 1;
                    break;
                case "从孕期":
                    myneirong = 2;
                    break;
                case "从成长期":
                    myneirong = 3;
                    break;
                default:
                    myneirong = -1;
                    break;
            }
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_baby_notice_detail);
        relativeLayout_shenfen = (RelativeLayout) findViewById(R.id.baby_notice_detail_shenfen);
        relativeLayout_shenfen.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (b_shenfen) {
                    Intent intent = new Intent(BabyNoticeDetailActivity.this, PetnameListActivity.class);
                    intent.putExtra("type", "shenfen");
                    intent.putExtra("shenfen", tv_shenfen.getText().toString().trim());
                    startActivityForResult(intent, 1);
                }
            }
        });
        relativeLayout_quanxian = (RelativeLayout) findViewById(R.id.baby_notice_detail_quanxian);
        relativeLayout_quanxian.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (b_quanxian) {
                    Intent intent = new Intent(BabyNoticeDetailActivity.this, PetnameListActivity.class);
                    intent.putExtra("type", "quanxian");
                    intent.putExtra("quanxian", tv_quanxian.getText().toString().trim());
                    if (myrole != 2) {
                        startActivityForResult(intent, 2);
                    }
                }
            }
        });
        relativeLayout_neirong = (RelativeLayout) findViewById(R.id.baby_notice_detail_neirong);
        relativeLayout_neirong.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (b_neirong) {
                    final LoginInfo loginInfo = Config.getLoginInfo(BabyNoticeDetailActivity.this);
                    final String userId = loginInfo.getUserID();
                    final int babyID = loginInfo.getBabyID();
                    Intent intent = new Intent(BabyNoticeDetailActivity.this, PetnameListActivity.class);
                    intent.putExtra("type", "neirong");
                    intent.putExtra("neirong", tv_neirong.getText().toString().trim());
                    intent.putExtra("userid", userId);
                    intent.putExtra("babyID", babyID);
                    intent.putExtra("permission", permission);
                    startActivityForResult(intent, 3);
                }
            }
        });
        toolbar = (CuteToolbar) findViewById(R.id.babynotice_detail_toolbar);
        toolbar.setOnClickCuteToolbarListener(this);
        tv_name = (CuteTextView) findViewById(R.id.tv_chengwei_and_nikename);
        tv_phone = (CuteTextView) findViewById(R.id.tv_notice_detail_phone);
        tv_nikename = (CuteTextView) findViewById(R.id.tv_nikename);
        tv_join_time = (CuteTextView) findViewById(R.id.tv_join_time);
        tv_shenfen = (CuteTextView) findViewById(R.id.tv_shenfen);
        tv_quanxian = (CuteTextView) findViewById(R.id.tv_diary_quanxian);
        tv_neirong = (CuteTextView) findViewById(R.id.tv_diary_neirong);
        phonenumber = (LinearLayout) findViewById(R.id.phonenumber);
        notice_detail_relation = (LinearLayout) findViewById(R.id.notice_detail_relation);
        notice_detail_relation.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(BabyNoticeDetailActivity.this,PetnameListActivity.class);
                intent.putExtra("type","relationship");
                intent.putExtra("relationship",tv_name.getText().toString());
                startActivityForResult(intent,023);
            }
        });
        btnCancel = (CuteButton) findViewById(R.id.babt_notice_btn_cancel);
        btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (delete) {
                    Intent intent = new Intent(BabyNoticeDetailActivity.this, DeleteDialogActivity.class);
                    startActivityForResult(intent, 1002);
                } else  if (isnotice){
//                    onLongClickNote();
                    final LoginInfo loginInfo = Config.getLoginInfo(BabyNoticeDetailActivity.this);
                    final    String userId = loginInfo.getUserID();
                    final String phone = loginInfo.getPhone();
                    final String token = loginInfo.getToken().getAccessToken();
                    final  int babyId = loginInfo.getBabyID();
                    Client.requestCancel(BabyNoticeDetailActivity.this, phone, token, babyId, babyAllResponse.getUserId(), new ResponseHandler() {

                        @Override
                        public void onInnovationStart() {
                            showProgressDialog(null, null);
                        }

                        @Override
                        public void onInnovationSuccess(JsonElement value) {
                            updateDb();
                        }

                        @Override
                        public void onInnovationFinish() {
                            dismissProgressDialog();
                        }

                        @Override
                        public void onInnovationExceptionFinish() {
                            dismissProgressDialog();
                        }

                    }, networkUnavailableSampleImpl());
                }else{
                    Intent intent = new Intent(BabyNoticeDetailActivity.this, ChangePermissionActivity.class);
                    intent.putExtra("info", info);
                    intent.putExtra("from", "noticedetail");
                    startActivity(intent);
                }
            }
        });
        imageView_head = (RoundedImageView) findViewById(R.id.iv_head_baby_notice_detail);
        iv_shenfen_next = (ImageView) findViewById(R.id.iv_shenfen_next);
        iv_quanxian_next = (ImageView) findViewById(R.id.iv_quanxian_next);
        iv_neirong_next = (ImageView) findViewById(R.id.iv_neirong_next);
        final LoginInfo login = Config.getLoginInfo(BabyNoticeDetailActivity.this);
        if (login == null) {
            return;
        }
        String phone = mLoginInfo.getPhone();
        init();
        if (!phone.equals(babyAllResponse.getPhone())){
//            phonenumber.setVisibility(View.GONE);
            notice_detail_relation.setVisibility(View.GONE);
        }
        registerBoradcastReceiver();
    }
    private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver(){
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if(action.equals(""+100)){
                finish();
            }
        }
    };
    public void registerBoradcastReceiver(){
        IntentFilter myIntentFilter = new IntentFilter();
        myIntentFilter.addAction(""+100);
        //注册广播
        registerReceiver(mBroadcastReceiver, myIntentFilter);
    }
    private void init(){
        Intent intent = getIntent();
        permission = getIntent().getStringExtra("permission");
        babyAllResponse = get(permission, BabyAllResponse.class);
        if (babyAllResponse == null) {
            return;
        }
        toolbar.setCuteTitle(babyAllResponse.getName());
        tv_name.setText(babyAllResponse.getName());
        tv_phone.setText(babyAllResponse.getPhone());
        tv_nikename.setText("昵称："+ ChZhRJUtils.getText(babyAllResponse.getNickName(), ""));

        myrole = role = babyAllResponse.getAuth().getRole();
        myper  = babyAllResponse.getAuth().getPermission();
        myneirong  = babyAllResponse.getAuth().getRange();
        switch (babyAllResponse.getAuth().getRange()) {
            case 0:
                range = "从加入后";
                break;
            case 1:
                range = "从备孕期";
                break;
            case 2:
                range = "从孕期";
                break;
            case 3:
                range = "从成长期";
                break;
        }

        switch (role){
            case 2:
                iv_shenfen_next.setVisibility(View.GONE);
                iv_quanxian_next.setVisibility(View.GONE);
                tv_shenfen.setText("大家长");
                btnCancel.setVisibility(View.VISIBLE);
                btnCancel.setText("转移大家长身份");
                switch (babyAllResponse.getAuth().getPermission()){
                    case 1:
                        tv_quanxian.setText("一起记");
                           break;
                    case  0 :
                        tv_quanxian.setText("围观");
                        break;
                }
//                switch (babyAllResponse.getAuth().getRange()){
//                    case 1:
//                        tv_neirong.setText("从备孕期");
//                        break;
//                    case  0 :
//                        tv_neirong.setText("从加入后");
//                        break;
//                    case  2 :
//                        tv_neirong.setText("从孕期");
//                        break;
//                    case  3 :
//                        tv_neirong.setText("从成长期");
//                        break;
//                }
                tv_neirong.setText("全部");
//                tv_quanxian.setText("一起记");
//                tv_neirong.setText("从备孕期");
                iv_neirong_next.setVisibility(View.GONE);
                b_quanxian = false;
                b_shenfen =false;
                b_neirong =false;
                break;
            case 1:
                isnotice = true;
                btnCancel.setText("删除关注人");
                btnCancel.setVisibility(View.VISIBLE);
                tv_shenfen.setText("家长");
                switch (babyAllResponse.getAuth().getPermission()){
                    case 1:
                        tv_quanxian.setText("一起记");
                        break;
                    case  0 :
                        tv_quanxian.setText("围观");
                        break;
                }
                switch (babyAllResponse.getAuth().getRange()){
                    case 1:
                        tv_neirong.setText("从备孕期");
                        break;
                    case  0 :
                        tv_neirong.setText("从加入后");
                        break;
                    case  2 :
                        tv_neirong.setText("从孕期");
                        break;
                    case  3 :
                        tv_neirong.setText("从成长期");
                        break;
                }
                tv_neirong.setText(range);
                iv_shenfen_next.setVisibility(View.VISIBLE);
                iv_quanxian_next.setVisibility(View.GONE);
                iv_neirong_next.setVisibility(View.VISIBLE);
                b_quanxian = false;
                b_shenfen =true;
                b_neirong =true;
                break;
            case 0:
                isnotice =true;
                btnCancel.setText("删除关注人");
                btnCancel.setVisibility(View.VISIBLE);
                tv_shenfen.setText("成员");
                switch (babyAllResponse.getAuth().getPermission()){
                    case 1:
                        tv_quanxian.setText("一起记");
                        break;
                    case  0 :
                        tv_quanxian.setText("围观");
                        break;
                }
                switch (babyAllResponse.getAuth().getRange()){
                    case 1:
                        tv_neirong.setText("从备孕期");
                        break;
                    case  0 :
                        tv_neirong.setText("从加入后");
                        break;
                    case  2 :
                        tv_neirong.setText("从孕期");
                        break;
                    case  3 :
                        tv_neirong.setText("从成长期");
                        break;
                }
                tv_neirong.setText(range);
                iv_shenfen_next.setVisibility(View.VISIBLE);
                iv_quanxian_next.setVisibility(View.VISIBLE);
                iv_neirong_next.setVisibility(View.VISIBLE);
                b_quanxian = true;
                b_shenfen =true;
                b_neirong =true;
                break;
        }
        String type = null;
        switch (babyAllResponse.getType()) {
            case 1:
                type = "创建日记";
                break;
            case 2:
                type = "由" + babyAllResponse.getUser() + "邀请加入";
                break;
            case 3:
                type = "由" + babyAllResponse.getUser() + "批准加入";
                break;
        }

        tv_join_time.setText(babyAllResponse.getServerTS() + "\u2000" + type);

        int length = getIntent().getIntExtra("length", 1);
        if (length == 1 && role ==2) {
            delete = true;
            btnCancel.setText("删除日记本");
            btnCancel.setVisibility(View.GONE);
        }
        info = getIntent().getStringExtra("info");

        setOptions();
        ImageLoader.getInstance().displayImage(babyAllResponse.getPath(), imageView_head, options);
    }


    @Override
    protected void onResume() {
        super.onResume();

    }

    public void onLongClickNote() {

        // 网络请求删除
        final LoginInfo loginInfo = Config.getLoginInfo(BabyNoticeDetailActivity.this);
        if (loginInfo == null) {
            return;
        }
        final String phone = loginInfo.getPhone();
        final String token = loginInfo.getToken().getAccessToken();
        final String userId = loginInfo.getUserID();
        final int babyId = loginInfo.getBabyID();
        // 判断权限
        BabyAndParent babyAndParent = DatabaseManager.getInstance(BabyNoticeDetailActivity.this).queryBabyAndParent(userId, babyId);
        if (babyAndParent.getRole() == 2) {
            Intent intent = new Intent(BabyNoticeDetailActivity.this, TipDeleteDialogActivity.class);
            startActivity(intent);
            return;
        }

        new AlertDialog.Builder(this).setTitle("取消对日记本的关注")
                .setPositiveButton("是", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Client.requestRemoveNote(BabyNoticeDetailActivity.this, phone, token, babyId, new ResponseHandler() {
                            @Override
                            public void onInnovationStart() {
                                showProgressDialog(null, null);
                            }

                            @Override
                            public void onInnovationSuccess(JsonElement value) {
//                                getAllBabyInfo(loginInfo, babyID);
                                dismissProgressDialog();
                            }

                            @Override
                            public void onChZhRJFailure(String value) {
                                dismissProgressDialog();
                                tipShow(value);
                            }

                            @Override
                            public void onChZhRJTokenFailure(String value) {
                                dismissProgressDialog();
                                tipShow(value);
                            }

                        }, networkUnavailableSampleImpl());
                    }
                })
                .setNegativeButton("否", null)
                .show();
    }

    private void delete() {
        // 网络请求删除
        final LoginInfo loginInfo = Config.getLoginInfo(this);
        if (loginInfo == null) {
            return;
        }
        String phone = loginInfo.getPhone();
        String token = loginInfo.getToken().getAccessToken();
        final int babyID = loginInfo.getBabyID();
        Client.requestRemoveNote(this, phone, token, babyID, new ResponseHandler() {

            @Override
            public void onInnovationStart() {
                showProgressDialog(null, null);
            }

            @Override
            public void onInnovationSuccess(JsonElement value) {
//                dismissProgressDialog();
//                sendDeleteBroadcast();
//                setResult(-1000);
//                finish();
                dismissProgressDialog();
                // 删除宝宝信息
                DatabaseManager.getInstance(BabyNoticeDetailActivity.this).deleteBaby(babyID);
                Intent intent = new Intent();
                intent.putExtra(Config.EXTRA_CAN_BACK, true);
                setResult(RESULT_OK, intent);
                finish();
//                updateDb();
            }

            @Override
            public void onChZhRJFailure(String value) {
                dismissProgressDialog();
                tipShow(value);
            }

            @Override
            public void onChZhRJTokenFailure(String value) {
                dismissProgressDialog();
                tipShow(value);
            }

        }, networkUnavailableSampleImpl());
    }
    private void setOptions() {
        options = new DisplayImageOptions.Builder()
                .showImageOnLoading(R.drawable.ic_head_circle_default_small)    //在ImageView加载过程中显示图片
                .showImageForEmptyUri(R.drawable.ic_head_circle_default_small)  //image连接地址为空时
                .showImageOnFail(R.drawable.ic_head_circle_default_small)  //image加载失败
                .cacheOnDisk(true)   //加载图片时会在磁盘中加载缓存
                .build();
    }
//    private void sendDeleteBroadcast() {
//        Intent intent = new Intent("delete");
//        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
//    }
    private void updateDb(){
        final LoginInfo loginInfo = Config.getLoginInfo(this);
        final String userId = loginInfo.getUserID();
        final String phone = loginInfo.getPhone();
        final String token = loginInfo.getToken().getAccessToken();
        final  int babyId = loginInfo.getBabyID();
        Client.requestBabyAll(BabyNoticeDetailActivity.this, phone, token, babyId, new ResponseHandler() {

            @Override
            public void onInnovationSuccess(JsonElement value) {
                super.onInnovationSuccess(value);
                JsonObject object = value.getAsJsonObject();
                JsonArray jsonArray = object.getAsJsonArray("Messages");
                BabyAllResponse[] responses = get(jsonArray.toString(), BabyAllResponse[].class);
                if (responses == null) {
                    return;
                }
                Parent[] parents = new Parent[responses.length];
                for (int i = 0; i < responses.length; i++) {
                    parents[i] = new Parent();
                    parents[i].setBabyId(babyId);
                    parents[i].setType(responses[i].getType());
                    parents[i].setParentId(responses[i].getUserId());
                    parents[i].setUser(responses[i].getUser());
                    parents[i].setName(responses[i].getName());
                    parents[i].setPhone(responses[i].getPhone());
                    parents[i].setServerTS(responses[i].getServerTS());
                    parents[i].setMessage(responses[i].getMessage());
                    parents[i].setPath(responses[i].getPath());
                    parents[i].setNickName(responses[i].getNickName());
                    parents[i].setRole(responses[i].getAuth().getRole());
                    parents[i].setPermission(responses[i].getAuth().getPermission());
                    parents[i].setRange(responses[i].getAuth().getRange());
                }
                DatabaseManager.getInstance(BabyNoticeDetailActivity.this).deleteAllParents(babyId);
                DatabaseManager.getInstance(BabyNoticeDetailActivity.this).insertOrReplaceInTxParent(parents);
                finish();
            }

        }, networkUnavailableSampleImpl());
    }
    private void babyUpload() {
        final LoginInfo login = Config.getLoginInfo(BabyNoticeDetailActivity.this);
        Log.e("asd", "" + login);
        if (login == null) {
            return;
        }
        String userId = mLoginInfo.getUserID();
        String phone = mLoginInfo.getPhone();
        String token = mLoginInfo.getToken().getAccessToken();
        final BabyAddRequestBody body = new BabyAddRequestBody();
        final int babyId = mLoginInfo.getBabyID();
        body.setParentName(tv_name.getText().toString());
        mOldRole =  tv_name.getText().toString();
        Change[] mChanges = new Change[1];
        mChanges[0] = new Change();
        mChanges[0].setKey("UserMemberName");
        mChanges[0].setValue(tv_name.getText().toString());
        final Baby babys = DatabaseManager.getInstance(BabyNoticeDetailActivity.this).queryBaby(userId, babyId);
        Client.requestBabyUpdate(this, phone, token, babyId, System.currentTimeMillis(), mChanges, new ResponseHandler() {

            @Override
            public void onInnovationStart() {
                showProgressDialog(null, null);
            }

            @Override
            public void onInnovationSuccess(JsonElement value) {
                babys.setParentName(tv_name.getText().toString());

                updateBaby(babys);
                updateTimeline(babys.getBabyID(), babys.getParentName());
                dismissProgressDialog();
//                setResult(Activity.RESULT_OK);
                finish();
            }

            @Override
            public void onChZhRJFailure(String value) {
                dismissProgressDialog();
                tipShow(value);
            }

            @Override
            public void onChZhRJTokenFailure(String value) {
                dismissProgressDialog();
                tipShow(value);
                finish();
            }
        }, networkUnavailableSampleImpl());
    }

    public void updateBaby(Baby baby) {
        DatabaseManager.getInstance(this).updateBaby(baby);
    }
    public void updateTimeline(int babyID, String newRole) {
        if (mOldRole.equals(newRole)) {
            return;
        }
        DatabaseManager.getInstance(this).updateRole(babyID, mOldRole, newRole);
    }
    @Override
    public void onClickLeft() {
        if (babyAllResponse.getAuth().getRole() == myrole && babyAllResponse.getAuth().getPermission() == myper
                && babyAllResponse.getAuth().getRange() == myneirong && babyAllResponse.getName().equals(tv_name.getText().toString())) {
            onBackPressed();
        }if (babyAllResponse.getAuth().getRole() == myrole && babyAllResponse.getAuth().getPermission() == myper
                && babyAllResponse.getAuth().getRange() == myneirong && !babyAllResponse.getName().equals(tv_name.getText().toString())){
            babyUpload();
        } else {
            // 网络请求
            LoginInfo loginInfo = Config.getLoginInfo(this);
            if (loginInfo == null) {
                return;
            }
            String phone = loginInfo.getPhone();
            String token = loginInfo.getToken().getAccessToken();
            int babyId = loginInfo.getBabyID();
            Client.requestSetPermission(this, phone, token, babyId, babyAllResponse.getUserId(), myrole, myper, myneirong, new ResponseHandler() {
                @Override
                public void onChZhRJFailure(String value) {
                    super.onChZhRJFailure(value);
//                    showProgressDialog(null, value);
                }


                @Override
                public void onInnovationSuccess(JsonElement value) {
                    super.onInnovationSuccess(value);
                    BabyNoticeDetailActivity.this.finish();
                }

                @Override
                public void onInnovationFinish() {
//                    dismissProgressDialog();
                }

                @Override
                public void onInnovationExceptionFinish() {
//                    dismissProgressDialog();
                }

            }, networkUnavailableSampleImpl());
        }
    }

    @Override
    public void onClickRight() {

    }
}
